home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / samba / patches / samba-1.039 / samba-1
Encoding:
Text File  |  1995-11-21  |  29.6 KB  |  999 lines

  1. diff -u -r --new-file last-version/docs/BROWSING.txt samba-1.9.15p2/docs/BROWSING.txt
  2. --- last-version/docs/BROWSING.txt    Tue Nov 14 22:29:10 1995
  3. +++ samba-1.9.15p2/docs/BROWSING.txt    Tue Nov 21 12:46:25 1995
  4. @@ -113,4 +113,3 @@
  5.  address it sends to, not what it listens on.
  6.  
  7.  
  8. -
  9. diff -u -r --new-file last-version/docs/THANKS samba-1.9.15p2/docs/THANKS
  10. --- last-version/docs/THANKS    Sun Sep  3 11:41:21 1995
  11. +++ samba-1.9.15p2/docs/THANKS    Tue Nov 21 11:56:40 1995
  12. @@ -91,3 +91,29 @@
  13.      NTAS. Being able to directly test NT3.5 allowed me to solve
  14.      several long standing NT<->Samba problems. Thanks Steve!
  15.  
  16. +John Terpstra (jht@aquasoft.com.au)
  17. +
  18. +        Aquasoft are a speciaist consulting company whose Samba using
  19. +        customers span the world.
  20. +
  21. +        Aquasoft have been avid supporters of the Samba project. As a
  22. +        token of appreciation Aquasoft have donated a 486DX2/66 PC with
  23. +        a 540MB EIDE drive and 20MB RAM.
  24. +
  25. +        John has helped to isolate quite a few little glitches over time
  26. +        and has managed to implement some very interesting installations
  27. +        of Samba.
  28. +
  29. +        The donation of the new PC will make it possible to more fully
  30. +        diagnose and observe the behaviour of Samba in conjuction with
  31. +        other SMB protocol utilising systems.
  32. +
  33. +
  34. +Timothy F. Sipples (tsipple@vnet.IBM.COM)
  35. +Steve Withers (swithers@vnet.IBM.COM)
  36. +
  37. +    Tim and Steve from IBM organised a copy of the OS/2 developers
  38. +    connection CD set for me, and gave lots of help in getting
  39. +    OS/2 Warp installed. I hope this will allow me to finally fix
  40. +    up those annoying OS/2 related Samba bugs that I have been
  41. +    receiving reports of.
  42. diff -u -r --new-file last-version/source/Makefile samba-1.9.15p2/source/Makefile
  43. --- last-version/source/Makefile    Tue Nov 14 21:28:52 1995
  44. +++ samba-1.9.15p2/source/Makefile    Tue Nov 21 11:27:50 1995
  45. @@ -49,7 +49,7 @@
  46.  # for browsing. This can also be set in nmbd (see nmbd(8))
  47.  # NOTE: If you set it to * then nmbd will try to find a workgroup on
  48.  # the local net
  49. -WORKGROUP = *
  50. +WORKGROUP = WORKGROUP
  51.  
  52.  # set this to the name of the default account, which is the one
  53.  # to use when no username or password is specified.  This can be overridden
  54. diff -u -r --new-file last-version/source/change-log samba-1.9.15p2/source/change-log
  55. --- last-version/source/change-log    Wed Nov 15 02:36:30 1995
  56. +++ samba-1.9.15p2/source/change-log    Tue Nov 21 12:50:13 1995
  57. @@ -1668,14 +1668,23 @@
  58.      <Jeroen.Schipper@let.ruu.nl>
  59.      - fixed critical bug in directory listings
  60.      - released p1
  61. +    - fixed one of the causes of "out of memory" while browsing
  62. +    - fixed manpage install script (Paul Blackman)
  63. +    - added DNS failures to name cache
  64. +    - fixed writebmpx bug (affects OS/2)
  65. +    - misc OS/2 fixes, mostly for EA handling
  66. +    - added SMBcopy
  67. +    - added "max ttl" option
  68. +    - arch detection patch from Bas Laarhoven <bas@vimec.nl>
  69.  
  70. -
  71.  ==========
  72.  todo:
  73.  
  74. +document max ttl option
  75. +
  76.  dup/close 0 for getopt?
  77.  
  78. -implement SMBmove and SMBcopy ??
  79. +implement SMBmove  ??
  80.  
  81.  add option to print more info about locked files (full path, share name
  82.  etc)
  83. diff -u -r --new-file last-version/source/client.c samba-1.9.15p2/source/client.c
  84. --- last-version/source/client.c    Tue Nov 14 21:54:30 1995
  85. +++ samba-1.9.15p2/source/client.c    Mon Nov 20 18:54:04 1995
  86. @@ -2204,6 +2204,68 @@
  87.  
  88.  
  89.  /****************************************************************************
  90. +  get info on a file
  91. +  ****************************************************************************/
  92. +static void cmd_stat(char *inbuf,char *outbuf)
  93. +{
  94. +  fstring buf;
  95. +  pstring fname;
  96. +  char *resp_data=NULL;
  97. +  char *resp_param=NULL;
  98. +  int resp_data_len = 0;
  99. +  int resp_param_len=0;
  100. +  char *p;
  101. +
  102. +  if (!next_token(NULL,buf,NULL)) {
  103. +    printf("stat <file>\n");
  104. +    return;
  105. +  }
  106. +
  107. +  strcpy(fname,cur_dir);
  108. +  strcat(fname,buf);
  109. +
  110. +  bzero(outbuf,smb_setup);
  111. +  set_message(outbuf,15,5 + 6 + strlen(fname)+1,True);
  112. +  CVAL(outbuf,smb_com) = SMBtrans2;
  113. +  SSVAL(outbuf,smb_tid,cnum);
  114. +  setup_pkt(outbuf);
  115. +  
  116. +  SSVAL(outbuf,smb_tpscnt,6 + strlen(fname)+1);
  117. +  SSVAL(outbuf,smb_tdscnt,0);
  118. +  SSVAL(outbuf,smb_mprcnt,2); 
  119. +  SSVAL(outbuf,smb_mdrcnt,26);
  120. +  SSVAL(outbuf,smb_msrcnt,0);
  121. +  SSVAL(outbuf,smb_flags,0); 
  122. +  SIVAL(outbuf,smb_timeout,0);
  123. +  SSVAL(outbuf,smb_pscnt,SVAL(outbuf,smb_tpscnt));
  124. +  SSVAL(outbuf,smb_psoff,smb_offset(smb_buf(outbuf)+3,outbuf));
  125. +  SSVAL(outbuf,smb_dscnt,0);
  126. +  SSVAL(outbuf,smb_dsoff,0);
  127. +  SSVAL(outbuf,smb_suwcnt,1);
  128. +
  129. +  SSVAL(outbuf,smb_setup0,TRANSACT2_QPATHINFO);
  130. +
  131. +  p = smb_buf(outbuf);
  132. +  *p++ = 0;            /* put in a null smb_name */
  133. +  *p++ = 'D'; *p++ = ' ';    /* this was added because OS/2 does it */
  134. +
  135. +  SSVAL(p,0,2); /* level */
  136. +  p += 6;
  137. +  strcpy(p,fname);
  138. +  p = skip_string(p,1);
  139. +
  140. +  send_smb(outbuf);
  141. +
  142. +  receive_trans2_response(inbuf,
  143. +              &resp_data_len,&resp_param_len,
  144. +              &resp_data,&resp_param);
  145. +
  146. +  if (resp_data) free(resp_data); resp_data = NULL;
  147. +  if (resp_param) free(resp_param); resp_param = NULL;
  148. +}
  149. +
  150. +
  151. +/****************************************************************************
  152.    print a file
  153.    ****************************************************************************/
  154.  static void cmd_print(char *inbuf,char *outbuf )
  155. @@ -3499,6 +3561,7 @@
  156.    {"printmode",cmd_printmode,"<graphics or text> set the print mode"},
  157.    {"queue",cmd_queue,"show the print queue"},
  158.    {"cancel",cmd_cancel,"<jobid> cancel a print queue entry"},
  159. +  {"stat",cmd_stat,"<file> get info on a file (experimental!)"},
  160.    {"quit",send_logout,"logoff the server"},
  161.    {"exit",send_logout,"logoff the server"},
  162.    {"newer",cmd_newer,"<file> only mget files newer than the specified local file"},
  163. diff -u -r --new-file last-version/source/installman.sh samba-1.9.15p2/source/installman.sh
  164. --- last-version/source/installman.sh    Thu Jun 29 17:38:03 1995
  165. +++ samba-1.9.15p2/source/installman.sh    Sat Nov 18 20:36:53 1995
  166. @@ -3,11 +3,16 @@
  167.  
  168.  echo Installing man pages in $MANDIR
  169.  
  170. -mkdir $MANDIR
  171. -mkdir $MANDIR/man1
  172. -mkdir $MANDIR/man5
  173. -mkdir $MANDIR/man8
  174. -mkdir $MANDIR/man7
  175. +for d in $MANDIR $MANDIR/man1 $MANDIR/man5 $MANDIR/man7 $MANDIR/man8; do
  176. +if [ ! -d $d ]; then
  177. +mkdir $d
  178. +if [ ! -d $d ]; then
  179. +  echo Failed to make directory $d
  180. +  exit 1
  181. +fi
  182. +fi
  183. +done
  184. +
  185.  cp ../docs/*.1 $MANDIR/man1
  186.  cp ../docs/*.5 $MANDIR/man5
  187.  cp ../docs/*.8 $MANDIR/man8
  188. diff -u -r --new-file last-version/source/ipc.c samba-1.9.15p2/source/ipc.c
  189. --- last-version/source/ipc.c    Sun Nov 12 18:39:37 1995
  190. +++ samba-1.9.15p2/source/ipc.c    Sat Nov 18 02:08:09 1995
  191. @@ -1008,7 +1008,7 @@
  192.    
  193.    len = struct_len;
  194.    p = *buf;
  195. -  if (*buflen < struct_len) return -1;
  196. +  if ((*buflen) < struct_len) return -1;
  197.    if (stringbuf)
  198.      {
  199.        p2 = *stringbuf;
  200. @@ -1017,7 +1017,7 @@
  201.    else
  202.      {
  203.        p2 = p + struct_len;
  204. -      l2 = *buflen - struct_len;
  205. +      l2 = (*buflen) - struct_len;
  206.      }
  207.    if (!baseaddr) baseaddr = p;
  208.    
  209. @@ -1059,15 +1059,15 @@
  210.         
  211.    if (stringbuf)
  212.      {
  213. -      *buf = p + struct_len;
  214. -      *buflen -= struct_len;
  215. -      *stringbuf = p2;
  216. -      *stringspace = l2;
  217. +      (*buf) = p + struct_len;
  218. +      (*buflen) -= struct_len;
  219. +      (*stringbuf) = p2;
  220. +      (*stringspace) = l2;
  221.      }
  222.    else
  223.      {
  224. -      *buf = p2;
  225. -      *buflen -= len;
  226. +      (*buf) = p2;
  227. +      (*buflen) -= len;
  228.      }
  229.    return len;
  230.  }
  231. @@ -1626,21 +1626,21 @@
  232.    p += 4;
  233.  
  234.    SIVAL(p,0,PTR_DIFF(p2,*rdata));
  235. -  strcpy(p2,lp_workgroup());
  236. +  strcpy(p2,my_workgroup());
  237.    p2 = skip_string(p2,1);
  238.    p += 4;
  239.  
  240. -  SCVAL(p,0,1);
  241. -  SCVAL(p,1,9);
  242. +  SCVAL(p,0,1); /* major version?? */
  243. +  SCVAL(p,1,9); /* minor version?? */
  244.    p += 2;
  245.  
  246.    SIVAL(p,0,PTR_DIFF(p2,*rdata));
  247. -  strcpy(p2,lp_workgroup());    /* login domain */
  248. +  strcpy(p2,my_workgroup());    /* login domain?? */
  249.    p2 = skip_string(p2,1);
  250.    p += 4;
  251.  
  252.    SIVAL(p,0,PTR_DIFF(p2,*rdata));
  253. -  strcpy(p2,"info 2");
  254. +  strcpy(p2,"");
  255.    p2 = skip_string(p2,1);
  256.    p += 4;
  257.  
  258. @@ -1826,7 +1826,7 @@
  259.      PACKI(&desc,"D",0);        /* password can change */
  260.      PACKI(&desc,"D",-1);        /* password must change */
  261.      PACKS(&desc,"z",local_machine);/* computer */
  262. -    PACKS(&desc,"z",lp_workgroup());/* domain */
  263. +    PACKS(&desc,"z",my_workgroup());/* domain */
  264.      PACKS(&desc,"z","");        /* script path */
  265.      PACKI(&desc,"D",0);        /* reserved */
  266.    }
  267. diff -u -r --new-file last-version/source/loadparm.c samba-1.9.15p2/source/loadparm.c
  268. --- last-version/source/loadparm.c    Wed Nov 15 00:05:39 1995
  269. +++ samba-1.9.15p2/source/loadparm.c    Tue Nov 21 12:42:00 1995
  270. @@ -143,6 +143,7 @@
  271.     int maxdisksize;
  272.     int lpqcachetime;
  273.     int os_level;
  274. +   int max_ttl;
  275.     BOOL bPreferredMaster;
  276.     BOOL bEncryptPasswords;
  277.     BOOL bStripDot;
  278. @@ -391,6 +392,7 @@
  279.    {"coding system",    P_INTEGER, P_GLOBAL, &coding_system, handle_coding_system},
  280.  #endif /* KANJI */
  281.    {"os level",         P_INTEGER, P_GLOBAL, &Globals.os_level,          NULL},
  282. +  {"max ttl",          P_INTEGER, P_GLOBAL, &Globals.max_ttl,           NULL},
  283.    {"preferred master", P_BOOL,    P_GLOBAL, &Globals.bPreferredMaster,  NULL},
  284.  
  285.    {"-valid",           P_BOOL,    P_LOCAL,  &sDefault.valid,            NULL},
  286. @@ -534,6 +536,7 @@
  287.    Globals.bNullPasswords = False;
  288.    Globals.bStripDot = False;
  289.    Globals.os_level = 0;
  290. +  Globals.max_ttl = 60*60*4; /* 2 hours default */
  291.    Globals.bPreferredMaster = True;
  292.  
  293.  #ifdef KANJI
  294. @@ -657,6 +660,7 @@
  295.  
  296.  
  297.  FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level)
  298. +FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl)
  299.  FN_GLOBAL_INTEGER(lp_max_log_size,&Globals.max_log_size)
  300.  FN_GLOBAL_INTEGER(lp_mangledstack,&Globals.mangled_stack)
  301.  FN_GLOBAL_INTEGER(lp_maxxmit,&Globals.max_xmit)
  302. @@ -1813,4 +1817,14 @@
  303.  
  304.  
  305.  
  306. +
  307. +/*******************************************************************
  308. +  get a workgroup - but map to standalone if '*'
  309. +  ******************************************************************/
  310. +char *my_workgroup(void)
  311. +{
  312. +  char *res = lp_workgroup();
  313. +  if (*res == '*') return("STANDALONE");
  314. +  return(res);
  315. +}
  316.  
  317. diff -u -r --new-file last-version/source/loadparm.h samba-1.9.15p2/source/loadparm.h
  318. --- last-version/source/loadparm.h    Tue Nov 14 20:59:30 1995
  319. +++ samba-1.9.15p2/source/loadparm.h    Tue Nov 21 12:42:14 1995
  320. @@ -57,6 +57,7 @@
  321.  extern char *lp_magicoutput(int iService);
  322.  extern char *lp_mangled_map(int iService);
  323.  extern int  lp_os_level(void);
  324. +extern int  lp_max_ttl(void);
  325.  extern int  lp_max_log_size(void);
  326.  extern int  lp_maxxmit(void);
  327.  extern int  lp_maxmux(void);
  328. @@ -144,4 +145,6 @@
  329.  extern int lp_max_connections(int iService);
  330.  extern BOOL lp_add_home(char *pservice,int ifrom,char *phome);
  331.  extern char *lp_string(char *s);
  332. +char *my_workgroup(void);
  333. +
  334.  #endif
  335. diff -u -r --new-file last-version/source/nameserv.c samba-1.9.15p2/source/nameserv.c
  336. --- last-version/source/nameserv.c    Wed Nov 15 01:28:08 1995
  337. +++ samba-1.9.15p2/source/nameserv.c    Tue Nov 21 12:44:03 1995
  338. @@ -445,6 +445,13 @@
  339.    add_server_entry(myname,
  340.             ServerType,
  341.             0,ServerComment);
  342. +
  343. +  if (lp_preferred_master()) {
  344. +    needelection = True;
  345. +    ElectionCriterion |= (1<<3);
  346. +  }
  347. +
  348. +  ElectionCriterion |= (lp_os_level() << 24);
  349.  }
  350.  
  351.  
  352. @@ -483,6 +490,7 @@
  353.    
  354.    fclose(f);
  355.    unlink(fname);
  356. +  chmod(fnamenew,0644);
  357.    rename(fnamenew,fname);   
  358.    DEBUG(3,("Wrote browse list %s\n",fname));
  359.  }
  360. @@ -978,6 +986,8 @@
  361.  
  362.    if (!listening(&dgram->dest_name)) return;
  363.  
  364. +  ttl = MIN(ttl,lp_max_ttl());
  365. +
  366.    /* add them to our browse list */
  367.    add_server_entry(name,servertype,ttl,comment);
  368.  }
  369. @@ -1310,7 +1320,7 @@
  370.    char *qname = nmb->question.question_name.name;
  371.    BOOL wildcard = (qname[0] == '*'); 
  372.    BOOL bcast = nmb->header.nm_flags.bcast;
  373. -  int ttl = nmb->additional->ttl;
  374. +  int ttl = MIN(lp_max_ttl(),nmb->additional->ttl);
  375.    int name_type = nmb->question.question_name.name_type;
  376.    int nb_flags = nmb->additional->rdata[0];
  377.    struct packet_struct p2;
  378. @@ -1533,15 +1543,17 @@
  379.        /* look it up with DNS */      
  380.        a = interpret_addr(qname);
  381.  
  382. +      putip((char *)&ip,(char *)&a);
  383. +
  384.        if (!a) {
  385.      /* no luck with DNS. We could possibly recurse here XXXX */
  386.      /* if this isn't a bcast then we should send a negative reply XXXX */
  387.      DEBUG(3,("no recursion\n"));
  388. +    add_host_entry(qname,name_type,True,60*60,DNSFAIL,ip);
  389.      return;
  390.        }
  391.  
  392.        /* add it to our cache of names. give it 2 hours in the cache */
  393. -      putip((char *)&ip,(char *)&a);
  394.        n = add_host_entry(qname,name_type,True,2*60*60,DNS,ip);
  395.  
  396.        /* failed to add it? yikes! */
  397. @@ -1571,7 +1583,13 @@
  398.  
  399.      retip = n->ip;
  400.      unique = n->unique;
  401. -  } 
  402. +
  403. +    /* it may have been an earlier failure */
  404. +    if (n->source == DNSFAIL) {
  405. +      DEBUG(3,("DNSFAIL\n"));
  406. +      return;
  407. +    }
  408. +  }
  409.  
  410.    /* if the IP is 0 then substitute my IP - we should see which one is on the 
  411.       right interface for the caller to do this right XXX */
  412. @@ -1882,13 +1900,6 @@
  413.      if (p) *p = 0;
  414.    }
  415.  
  416. -  if (lp_preferred_master()) {
  417. -    needelection = True;
  418. -    ElectionCriterion |= (1<<3);
  419. -  }
  420. -
  421. -  ElectionCriterion |= (lp_os_level() << 28);  
  422. -
  423.    return True;
  424.  }
  425.  
  426. @@ -2027,6 +2038,8 @@
  427.    DEBUG(1,("%s netbios nameserver version %s started\n",timestring(),VERSION));
  428.    DEBUG(1,("Copyright Andrew Tridgell 1994\n"));
  429.  
  430. +  init_structs();
  431. +
  432.    if (!reload_services(False))
  433.      return(-1);    
  434.  
  435. @@ -2035,8 +2048,6 @@
  436.        load_hosts_file(host_file);
  437.        DEBUG(3,("Loaded hosts file\n"));
  438.      }
  439. -
  440. -  init_structs();
  441.  
  442.    if (!*ServerComment)
  443.      strcpy(ServerComment,"Samba %v");
  444. diff -u -r --new-file last-version/source/nameserv.h samba-1.9.15p2/source/nameserv.h
  445. --- last-version/source/nameserv.h    Sun Nov 12 13:40:15 1995
  446. +++ samba-1.9.15p2/source/nameserv.h    Sun Nov 19 17:50:31 1995
  447. @@ -26,7 +26,7 @@
  448.  #define NMB_PORT 137
  449.  #define DGRAM_PORT 138
  450.  
  451. -enum name_source {LMHOSTS, REGISTER, SELF, DNS};
  452. +enum name_source {LMHOSTS, REGISTER, SELF, DNS, DNSFAIL};
  453.  enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3};
  454.  enum packet_type {NMB_PACKET, DGRAM_PACKET};
  455.  
  456. diff -u -r --new-file last-version/source/reply.c samba-1.9.15p2/source/reply.c
  457. --- last-version/source/reply.c    Mon Nov 13 19:30:23 1995
  458. +++ samba-1.9.15p2/source/reply.c    Tue Nov 21 00:06:48 1995
  459. @@ -410,7 +410,7 @@
  460.      p = smb_buf(outbuf);
  461.      strcpy(p,"Unix"); p = skip_string(p,1);
  462.      strcpy(p,"Samba "); strcat(p,VERSION); p = skip_string(p,1);
  463. -    strcpy(p,lp_workgroup()); p = skip_string(p,1);
  464. +    strcpy(p,my_workgroup()); p = skip_string(p,1);
  465.      outsize = set_message(outbuf,3,PTR_DIFF(p,smb_buf(outbuf)),False);
  466.      /* perhaps grab OS version here?? */
  467.    }
  468. @@ -2566,7 +2566,194 @@
  469.    return(outsize);
  470.  }
  471.  
  472. +/*******************************************************************
  473. +  copy a file as part of a reply_copy
  474. +  ******************************************************************/
  475. +static BOOL copy_file(char *src,char *dest1,int cnum,int ofun,
  476. +              int count,BOOL target_is_directory)
  477. +{
  478. +  int Access,action;
  479. +  struct stat st;
  480. +  int ret;
  481. +  int fnum1,fnum2;
  482. +  pstring dest;
  483. +  
  484. +  strcpy(dest,dest1);
  485. +  if (target_is_directory) {
  486. +    char *p = strrchr(src,'/');
  487. +    if (p) 
  488. +      p++;
  489. +    else
  490. +      p = src;
  491. +    strcat(dest,"/");
  492. +    strcat(dest,p);
  493. +  }
  494. +
  495. +  if (!file_exist(src,&st)) return(False);
  496. +
  497. +  fnum1 = find_free_file();
  498. +  if (fnum1<0) return(False);
  499. +  open_file_shared(fnum1,cnum,src,(DENY_NONE<<4),
  500. +           1,0,&Access,&action);
  501. +
  502. +  if (!Files[fnum1].open) return(False);
  503. +
  504. +  if (!target_is_directory && count)
  505. +    ofun = 1;
  506. +
  507. +  fnum2 = find_free_file();
  508. +  if (fnum2<0) {
  509. +    close_file(fnum1);
  510. +    return(False);
  511. +  }
  512. +  open_file_shared(fnum2,cnum,dest,(DENY_NONE<<4)|1,
  513. +           ofun,st.st_mode,&Access,&action);
  514. +
  515. +  if (!Files[fnum2].open) {
  516. +    close_file(fnum1);
  517. +    return(False);
  518. +  }
  519. +
  520. +  if ((ofun&3) == 1) {
  521. +    lseek(Files[fnum2].fd,0,SEEK_END);
  522. +  }
  523. +  
  524. +  if (st.st_size)
  525. +    ret = transfer_file(Files[fnum1].fd,Files[fnum2].fd,st.st_size,NULL,0,0);
  526. +
  527. +  close_file(fnum1);
  528. +  close_file(fnum2);
  529. +
  530. +  return(ret == st.st_size);
  531. +}
  532. +
  533. +
  534. +
  535. +/****************************************************************************
  536. +  reply to a file copy.
  537. +  ****************************************************************************/
  538. +int reply_copy(char *inbuf,char *outbuf)
  539. +{
  540. +  int outsize = 0;
  541. +  pstring name;
  542. +  int cnum;
  543. +  pstring directory;
  544. +  pstring mask,newname;
  545. +  char *p;
  546. +  int count=0;
  547. +  int error = ERRnoaccess;
  548. +  BOOL has_wild;
  549. +  BOOL exists=False;
  550. +  int tid2 = SVAL(inbuf,smb_vwv0);
  551. +  int ofun = SVAL(inbuf,smb_vwv1);
  552. +  int flags = SVAL(inbuf,smb_vwv2);
  553. +  BOOL target_is_directory=False;
  554. +
  555. +  *directory = *mask = 0;
  556. +
  557. +  cnum = SVAL(inbuf,smb_tid);
  558. +  
  559. +  strcpy(name,smb_buf(inbuf));
  560. +  strcpy(newname,smb_buf(inbuf) + 1 + strlen(name));
  561. +   
  562. +  DEBUG(3,("reply_copy : %s -> %s\n",name,newname));
  563. +   
  564. +  if (tid2 != cnum) {
  565. +    /* can't currently handle inter share copies XXXX */
  566. +    DEBUG(3,("Rejecting inter-share copy\n"));
  567. +    return(ERROR(ERRSRV,ERRinvdevice));
  568. +  }
  569. +
  570. +  unix_convert(name,cnum);
  571. +  unix_convert(newname,cnum);
  572. +
  573. +  target_is_directory = directory_exist(newname,NULL);
  574. +
  575. +  if ((flags&1) && target_is_directory) {
  576. +    return(ERROR(ERRDOS,ERRbadfile));
  577. +  }
  578. +
  579. +  if ((flags&2) && !target_is_directory) {
  580. +    return(ERROR(ERRDOS,ERRbadpath));
  581. +  }
  582. +
  583. +  if ((flags&(1<<5)) && directory_exist(name,NULL)) {
  584. +    /* wants a tree copy! XXXX */
  585. +    DEBUG(3,("Rejecting tree copy\n"));
  586. +    return(ERROR(ERRSRV,ERRerror));    
  587. +  }
  588. +
  589. +  p = strrchr(name,'/');
  590. +  if (!p) {
  591. +    strcpy(directory,"./");
  592. +    strcpy(mask,name);
  593. +  } else {
  594. +    *p = 0;
  595. +    strcpy(directory,name);
  596. +    strcpy(mask,p+1);
  597. +  }
  598. +
  599. +  if (is_mangled(mask))
  600. +    check_mangled_stack(mask);
  601. +
  602. +  has_wild = strchr(mask,'*') || strchr(mask,'?');
  603. +
  604. +  if (!has_wild) {
  605. +    strcat(directory,"/");
  606. +    strcat(directory,mask);
  607. +    if (resolve_wildcards(directory,newname) && 
  608. +    copy_file(directory,newname,cnum,ofun,
  609. +          count,target_is_directory)) count++;
  610. +    if (!count) exists = file_exist(directory,NULL);
  611. +  } else {
  612. +    void *dirptr = NULL;
  613. +    char *dname;
  614. +    pstring destname;
  615. +
  616. +    if (check_name(directory,cnum))
  617. +      dirptr = OpenDir(directory);
  618. +
  619. +    if (dirptr)
  620. +      {
  621. +    error = ERRbadfile;
  622. +
  623. +    if (strequal(mask,"????????.???"))
  624. +      strcpy(mask,"*");
  625. +
  626. +    while ((dname = ReadDirName(dirptr)))
  627. +      {
  628. +        pstring fname;
  629. +        strcpy(fname,dname);
  630. +        
  631. +        if(!mask_match(fname, mask, case_sensitive, False)) continue;
  632. +
  633. +        error = ERRnoaccess;
  634. +        sprintf(fname,"%s/%s",directory,dname);
  635. +        strcpy(destname,newname);
  636. +        if (resolve_wildcards(fname,destname) && 
  637. +        copy_file(directory,newname,cnum,ofun,
  638. +              count,target_is_directory)) count++;
  639. +        DEBUG(3,("reply_copy : doing copy on %s -> %s\n",fname,destname));
  640. +      }
  641. +    CloseDir(dirptr);
  642. +      }
  643. +  }
  644. +  
  645. +  if (count == 0) {
  646. +    if (exists)
  647. +      return(ERROR(ERRDOS,error));
  648. +    else
  649. +      return(UNIXERROR(ERRDOS,error));
  650. +  }
  651. +  
  652. +  outsize = set_message(outbuf,1,0,True);
  653. +  SSVAL(outbuf,smb_vwv0,count);
  654.  
  655. +  return(outsize);
  656. +}
  657. +
  658. +
  659. +
  660.  /****************************************************************************
  661.    reply to a setdir
  662.  ****************************************************************************/
  663. @@ -2837,6 +3024,17 @@
  664.    DEBUG(3,("%s writebmpx fnum=%d cnum=%d num=%d wrote=%d\n",
  665.      timestring(),fnum,cnum,numtowrite,nwritten));
  666.    
  667. +  if (write_through && tcount==nwritten) {
  668. +    /* we need to send both a primary and a secondary response */
  669. +    smb_setlen(outbuf,outsize - 4);
  670. +    send_smb(outbuf);
  671. +
  672. +    /* now the secondary */
  673. +    outsize = set_message(outbuf,1,0,True);
  674. +    CVAL(outbuf,smb_com) = SMBwritec;
  675. +    SSVAL(outbuf,smb_vwv0,nwritten);
  676. +  }
  677. +
  678.    return(outsize);
  679.  }
  680.  
  681. diff -u -r --new-file last-version/source/reply.h samba-1.9.15p2/source/reply.h
  682. --- last-version/source/reply.h    Sat Apr 22 21:10:39 1995
  683. +++ samba-1.9.15p2/source/reply.h    Mon Nov 20 22:59:13 1995
  684. @@ -45,6 +45,7 @@
  685.  int reply_mkdir(char *inbuf,char *outbuf);
  686.  int reply_rmdir(char *inbuf,char *outbuf);
  687.  int reply_mv(char *inbuf,char *outbuf);
  688. +int reply_copy(char *inbuf,char *outbuf);
  689.  int reply_setdir(char *inbuf,char *outbuf);
  690.  int reply_lockingX(char *inbuf,char *outbuf,int length,int bufsize);
  691.  int reply_readbmpx(char *inbuf,char *outbuf,int length,int bufsize);
  692. diff -u -r --new-file last-version/source/server.c samba-1.9.15p2/source/server.c
  693. --- last-version/source/server.c    Tue Nov 14 23:15:32 1995
  694. +++ samba-1.9.15p2/source/server.c    Tue Nov 21 12:49:16 1995
  695. @@ -1212,6 +1212,14 @@
  696.    Files[fnum].open = False;
  697.    Files[fnum].fd = -1;
  698.  
  699. +  /* this is for OS/2 EAs - try and say we don't support them */
  700. +  if (strstr(fname,".+,;=[].")) {
  701. +    /* errno = ENOENT; */
  702. +    unix_ERR_class = ERRDOS;
  703. +    unix_ERR_code = ERROR_EAS_NOT_SUPPORTED;
  704. +    return;
  705. +  }
  706. +
  707.    if ((ofun & 0x3) == 0 && file_existed) {
  708.      errno = EEXIST;
  709.      return;
  710. @@ -2459,7 +2467,7 @@
  711.        !pcon->read_only)
  712.      {
  713.        pcon->admin_user = True;
  714. -      DEBUG(0,("%s logged in as admin user (root privilages)\n",user));
  715. +      DEBUG(0,("%s logged in as admin user (root privileges)\n",user));
  716.      }
  717.    else
  718.      pcon->admin_user = False;
  719. @@ -2864,37 +2872,36 @@
  720.    int protocol;
  721.    char *p;
  722.    int bcc = SVAL(smb_buf(inbuf),-2);
  723. +  int maybe_win95 = 0;
  724. +  int arch_known = 0;
  725.  
  726. -  /* look through the protocol list */
  727. +  /* look through the protocol list to determine architecture */
  728.    Index = 0;
  729.    p = smb_buf(inbuf)+1;
  730.    while (p < (smb_buf(inbuf) + bcc))
  731.      { 
  732.        DEBUG(3,("protocol [%s]\n",p));
  733. -      if (strcsequal(p,"Windows for Workgroups 3.1a"))
  734. -    strcpy(remote_arch,"WfWg");
  735. -
  736. -      if (strcsequal(p,"Samba")) {
  737. -    strcpy(remote_arch,"Samba");
  738. -    break; /* definite */
  739. -      }
  740. -
  741. -      if (strcsequal(p,"NT LM 0.12"))
  742. -    strcpy(remote_arch,"WinNT");
  743. -
  744. -      if (strcsequal(p,"DOS LANMAN2.1")) {
  745. -    strcpy(remote_arch,"Win95");
  746. -    break; /* definite */
  747. +      if (!arch_known) {
  748. +        if (strcsequal(p,"Samba")) {
  749. +          strcpy(remote_arch,"Samba");
  750. +          arch_known = 1;
  751. +        } else if (strcsequal(p,"NT LM 0.12")) {
  752. +          if (maybe_win95)
  753. +            strcpy(remote_arch,"Win95");
  754. +          else
  755. +            strcpy(remote_arch,"WinNT");
  756. +        } else if (strcsequal(p,"Windows for Workgroups 3.1a")) {
  757. +          strcpy(remote_arch,"WfWg");
  758. +          maybe_win95 = 1;
  759. +        }
  760. +        Index++;
  761.        }
  762. -
  763.        p += strlen(p) + 2;
  764. -      Index++;
  765.      }
  766. -
  767. -
  768. +  
  769.    /* possibly reload - change of architecture */
  770.    reload_services(True);      
  771. -
  772. +  
  773.    /* a special case to stop password server loops */
  774.    if (Index == 1 && strequal(remote_machine,myhostname) && 
  775.        lp_security()==SEC_SERVER)
  776. @@ -3418,7 +3425,7 @@
  777.     {SMBtrans,"SMBtrans",reply_trans,AS_USER | CAN_IPC},
  778.     {SMBtranss,"SMBtranss",NULL,AS_USER | CAN_IPC},
  779.     {SMBioctls,"SMBioctls",NULL,AS_USER},
  780. -   {SMBcopy,"SMBcopy",NULL,AS_USER},
  781. +   {SMBcopy,"SMBcopy",reply_copy,AS_USER | NEED_WRITE},
  782.     {SMBmove,"SMBmove",NULL,AS_USER | NEED_WRITE},
  783.     
  784.     {SMBopenX,"SMBopenX",reply_open_and_X,AS_USER},
  785. diff -u -r --new-file last-version/source/status.c samba-1.9.15p2/source/status.c
  786. --- last-version/source/status.c    Mon Nov 13 15:53:03 1995
  787. +++ samba-1.9.15p2/source/status.c    Fri Nov 17 08:33:15 1995
  788. @@ -135,7 +135,8 @@
  789.      else      
  790.        printf("%-10.10s   %-8s %-8s %5d   %-8s (%s) %s",
  791.           crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid,
  792. -         crec.machine,crec.addr,asctime(LocalTime(&crec.start,0)));
  793. +         crec.machine,crec.addr,
  794. +         asctime(LocalTime(&crec.start,GMT_TO_LOCAL)));
  795.        }
  796.      }
  797.    fclose(f);
  798. diff -u -r --new-file last-version/source/trans2.c samba-1.9.15p2/source/trans2.c
  799. --- last-version/source/trans2.c    Tue Nov 14 21:58:26 1995
  800. +++ samba-1.9.15p2/source/trans2.c    Mon Nov 20 19:08:34 1995
  801. @@ -31,6 +31,7 @@
  802.  extern files_struct Files[];
  803.  extern BOOL case_sensitive;
  804.  
  805. +#define ROUNDUP(x,g) (((x)+((g)-1))&~((g)-1))
  806.  
  807.  /****************************************************************************
  808.    Send the required number of replies back.
  809. @@ -371,7 +372,7 @@
  810.        put_dos_date2(p,l1_fdateLastAccess,adate);
  811.        put_dos_date2(p,l1_fdateLastWrite,mdate);
  812.        SIVAL(p,l1_cbFile,size);
  813. -      SIVAL(p,l1_cbFileAlloc,1024); /* Make 1024 for now */
  814. +      SIVAL(p,l1_cbFileAlloc,ROUNDUP(size,1024));
  815.        SSVAL(p,l1_attrFile,mode);
  816.        SCVAL(p,l1_cchName,strlen(fname));
  817.        strcpy(p + l1_achName, fname);
  818. @@ -389,7 +390,7 @@
  819.        put_dos_date2(p,l2_fdateLastAccess,adate);
  820.        put_dos_date2(p,l2_fdateLastWrite,mdate);
  821.        SIVAL(p,l2_cbFile,size);
  822. -      SIVAL(p,l2_cbFileAlloc,1024); /* Make 1024 for now */
  823. +      SIVAL(p,l2_cbFileAlloc,ROUNDUP(size,1024));
  824.        SSVAL(p,l2_attrFile,mode);
  825.        SIVAL(p,l2_cbList,0); /* No extended attributes */
  826.        SCVAL(p,l2_cchName,strlen(fname));
  827. @@ -404,7 +405,7 @@
  828.        put_dos_date2(p,8,adate);
  829.        put_dos_date2(p,12,mdate);
  830.        SIVAL(p,16,size);
  831. -      SIVAL(p,20,1024);
  832. +      SIVAL(p,20,ROUNDUP(size,1024));
  833.        SSVAL(p,24,mode);
  834.        SIVAL(p,26,4);
  835.        CVAL(p,30) = strlen(fname);
  836. @@ -423,7 +424,7 @@
  837.        put_dos_date2(p,8,adate);
  838.        put_dos_date2(p,12,mdate);
  839.        SIVAL(p,16,size);
  840. -      SIVAL(p,20,1024);
  841. +      SIVAL(p,20,ROUNDUP(size,1024));
  842.        SSVAL(p,24,mode);
  843.        CVAL(p,32) = strlen(fname);
  844.        strcpy(p + 33, fname);
  845. @@ -970,7 +971,9 @@
  846.    reply to a TRANS2_QFILEINFO (query file info by fileid)
  847.  ****************************************************************************/
  848.  static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length, 
  849. -                 int bufsize,int cnum,char **pparams,char **ppdata)
  850. +                    int bufsize,int cnum,
  851. +                    char **pparams,char **ppdata,
  852. +                    int total_data)
  853.  {
  854.    char *params = *pparams;
  855.    char *pdata = *ppdata;
  856. @@ -1013,8 +1016,8 @@
  857.    }
  858.  
  859.  
  860. -  DEBUG(3,("call_trans2qfilepathinfo %s level=%d call=%d\n",
  861. -       fname,info_level,tran_call));
  862. +  DEBUG(3,("call_trans2qfilepathinfo %s level=%d call=%d total_data=%d\n",
  863. +       fname,info_level,tran_call,total_data));
  864.  
  865.    p = strrchr(fname,'/'); 
  866.    if (!p) 
  867. @@ -1028,8 +1031,22 @@
  868.    
  869.    params = *pparams = Realloc(*pparams,2); bzero(params,2);
  870.    data_size = 1024;
  871. -  pdata = *ppdata = Realloc(*ppdata, data_size); bzero(pdata,data_size);
  872. +  pdata = *ppdata = Realloc(*ppdata, data_size); 
  873.  
  874. +  if (total_data > 0 && IVAL(pdata,0) == total_data) {
  875. +    /* uggh, EAs for OS2 */
  876. +    DEBUG(4,("Rejecting EA request with total_data=%d\n",total_data));
  877. +#if 0
  878. +    SSVAL(params,0,ERROR_EAS_NOT_SUPPORTED);
  879. +    send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0);
  880. +    return(-1);
  881. +#else
  882. +    return(ERROR(ERRDOS,ERROR_EAS_NOT_SUPPORTED));
  883. +#endif
  884. +  }
  885. +
  886. +  bzero(pdata,data_size);
  887. +
  888.    switch (info_level) 
  889.      {
  890.      case 1:
  891. @@ -1039,8 +1056,9 @@
  892.        put_dos_date2(pdata,l1_fdateLastAccess,sbuf.st_atime);
  893.        put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime);
  894.        SIVAL(pdata,l1_cbFile,size);
  895. -      SIVAL(pdata,l1_cbFileAlloc,1024); /* Make 1024 for now */
  896. +      SIVAL(pdata,l1_cbFileAlloc,ROUNDUP(size,1024));
  897.        SSVAL(pdata,l1_attrFile,mode);
  898. +      SIVAL(pdata,l1_attrFile+2,4); /* this is what OS2 does */
  899.        break;
  900.  
  901.      case 3:
  902. @@ -1050,7 +1068,7 @@
  903.        put_dos_date2(pdata,4,sbuf.st_atime);
  904.        put_dos_date2(pdata,8,sbuf.st_mtime);
  905.        SIVAL(pdata,12,size);
  906. -      SIVAL(pdata,16,1024);
  907. +      SIVAL(pdata,16,ROUNDUP(size,1024));
  908.        SIVAL(pdata,20,mode);
  909.        break;
  910.  
  911. @@ -1203,6 +1221,16 @@
  912.    tvs.actime = st.st_atime;
  913.    mode = dos_mode(cnum,fname,&st);
  914.  
  915. +  if (total_data > 0 && IVAL(pdata,0) == total_data) {
  916. +    /* uggh, EAs for OS2 */
  917. +    DEBUG(4,("Rejecting EA request with total_data=%d\n",total_data));
  918. +    SSVAL(params,0,ERROR_EAS_NOT_SUPPORTED);
  919. +
  920. +    send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0);
  921. +  
  922. +    return(-1);    
  923. +  }
  924. +
  925.    switch (info_level)
  926.      {
  927.      case 1:
  928. @@ -1213,8 +1241,6 @@
  929.        break;
  930.  
  931.      case 2:
  932. -      if(IVAL(pdata,l2_cbList) || total_data>32)
  933. -    return(ERROR(ERRDOS,ERROR_EAS_NOT_SUPPORTED));
  934.        tvs.actime = make_unix_date2(pdata+l1_fdateLastAccess);
  935.        tvs.modtime = make_unix_date2(pdata+l1_fdateLastWrite);
  936.        mode = SVAL(pdata,l1_attrFile);
  937. @@ -1229,8 +1255,6 @@
  938.        break;
  939.  
  940.      case 4:
  941. -      if (IVAL(pdata,28) != 0 || total_data>36)
  942. -    return(ERROR(ERRDOS,ERROR_EAS_NOT_SUPPORTED));    
  943.        tvs.actime = make_unix_date2(pdata+8);
  944.        tvs.modtime = make_unix_date2(pdata+12);
  945.        size = IVAL(pdata,16);
  946. @@ -1238,7 +1262,7 @@
  947.        break;
  948.  
  949.      case SMB_SET_FILE_BASIC_INFO:
  950. -      pdata += 8; /* create time */
  951. +      pdata += 8;        /* create time */
  952.        tvs.actime = interpret_long_date(pdata); pdata += 8;
  953.        tvs.modtime=MAX(interpret_long_date(pdata),interpret_long_date(pdata+8));
  954.        pdata += 16;
  955. @@ -1246,7 +1270,7 @@
  956.        break;
  957.  
  958.      case SMB_SET_FILE_END_OF_FILE_INFO:
  959. -      if (IVAL(pdata,4) != 0) /* more than 32 bits? */
  960. +      if (IVAL(pdata,4) != 0)    /* more than 32 bits? */
  961.      return(ERROR(ERRDOS,ERRunknownlevel));
  962.        size = IVAL(pdata,0);
  963.        break;
  964. @@ -1257,6 +1281,7 @@
  965.        return(ERROR(ERRDOS,ERRunknownlevel));
  966.      }
  967.  
  968. +
  969.    if (!tvs.actime) tvs.actime = st.st_atime;
  970.    if (!tvs.modtime) tvs.modtime = st.st_mtime;
  971.    if (!size) size = st.st_size;
  972. @@ -1552,7 +1577,7 @@
  973.        break;
  974.      case TRANSACT2_QPATHINFO:
  975.      case TRANSACT2_QFILEINFO:
  976. -      outsize = call_trans2qfilepathinfo(inbuf, outbuf, length, bufsize, cnum, ¶ms, &data);
  977. +      outsize = call_trans2qfilepathinfo(inbuf, outbuf, length, bufsize, cnum, ¶ms, &data, total_data);
  978.        break;
  979.      case TRANSACT2_SETPATHINFO:
  980.      case TRANSACT2_SETFILEINFO:
  981. diff -u -r --new-file last-version/source/util.c samba-1.9.15p2/source/util.c
  982. --- last-version/source/util.c    Wed Nov 15 02:31:00 1995
  983. +++ samba-1.9.15p2/source/util.c    Tue Nov 21 12:39:49 1995
  984. @@ -3675,7 +3675,7 @@
  985.    } else {
  986.      /* otherwise assume it's a network name of some sort and use Get_Hostbyname */
  987.      if ((hp = Get_Hostbyname(str)) == 0) {
  988. -      DEBUG(0,("Get_Hostbyname: Unknown host. %s\n",str));
  989. +      DEBUG(3,("Get_Hostbyname: Unknown host. %s\n",str));
  990.        return 0;
  991.      }
  992.      putip((char *)&res,(char *)hp->h_addr);
  993. diff -u -r --new-file last-version/source/version.h samba-1.9.15p2/source/version.h
  994. --- last-version/source/version.h    Wed Nov 15 02:36:44 1995
  995. +++ samba-1.9.15p2/source/version.h    Tue Nov 21 12:52:20 1995
  996. @@ -1 +1 @@
  997. -#define VERSION "1.9.15p1"
  998. +#define VERSION "1.9.15p2"
  999.